Skip to content

Array 2#1871

Open
MeghaN28 wants to merge 1 commit intosuper30admin:masterfrom
MeghaN28:master
Open

Array 2#1871
MeghaN28 wants to merge 1 commit intosuper30admin:masterfrom
MeghaN28:master

Conversation

@MeghaN28
Copy link
Copy Markdown

No description provided.

@super30admin
Copy link
Copy Markdown
Owner

Disappeared Numbers (GameofLife.java)

It appears there has been a mix-up in the problem you are solving. The problem you are asked to solve is "Disappeared Numbers", which requires finding all numbers in the range [1, n] that are missing from an array. However, the code you submitted is for "Game of Life", which is a different problem entirely.

For the Disappeared Numbers problem, you need to implement a solution that processes an array of integers and returns the missing numbers. The reference solution provided is a brute-force approach that checks for each number from 1 to n whether it exists in the array. However, this approach has O(n^2) time complexity and may not be efficient for large n.

You should consider implementing a more efficient solution, such as using a hash set to store the numbers and then checking for missing ones (which would be O(n) time and space), or using an in-place marking technique to achieve O(n) time and O(1) space (excluding the output list).

Please review the problem statement again and implement the correct solution for Disappeared Numbers.

VERDICT: NEEDS_IMPROVEMENT


max and min (GameofLife2.java)

It seems there has been a mix-up in the problem you were asked to solve. The problem you solved is "Game of Life", but the problem you were assigned is "max and min", which requires finding the minimum and maximum values in an array with a constraint on the number of comparisons.

For the "max and min" problem, you need to implement an algorithm that finds the min and max in less than 2*(N-2) comparisons. The reference solution provided uses a method that processes elements in pairs, which reduces the number of comparisons.

I recommend revisiting the problem statement and implementing the correct solution. Your solution for the Game of Life is good for that problem, but it does not address the min-max problem.

If you are working on multiple problems, ensure you are submitting the correct code for the correct problem.

VERDICT: NEEDS_IMPROVEMENT


Life Game (MissinNumber1.java)

It appears that you have submitted a solution for the "Missing Number" problem instead of the "Game of Life" problem. Please double-check the problem you are solving and ensure your code matches the problem requirements. For the Game of Life problem, you need to implement the rules that update the board simultaneously for every cell. You should consider using an in-place approach with state changes that can be later converted back to 0s and 1s, as shown in the reference solution.

VERDICT: NEEDS_IMPROVEMENT

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants